﻿using SUNRPA.CONTROLS.IMPL.domain.attrubutes;
using SUNRPA.CONTROLS.IMPL.domain.flowRunningVar;
using SUNRPA.CONTROLS.IMPL.util;
using System.Collections.Concurrent;

namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    [VarFieldName("WindowObj")]
    public class GetWinWindowObjNParam:BaseParam {
        //获取窗口方式0标题或类名、1捕获窗口元素、2当前激活窗口、3、桌面
        private int getWindowMethod = 0;
        private string title;
        private string className;
        private bool isPattern;
        private WinElement windowEle;
        private string windowObj = "softWindowObj";
        public int GetWindowMethod {
            get => getWindowMethod; 
            set { 
                getWindowMethod = value;
                NotifyPropertyChanged("GetWindowMethod");
            }  
        }
        public string WindowObj {
            get => windowObj; 
            set { 
                windowObj = value;
                NotifyPropertyChanged("WindowObj");
            }  
        }
        public string Title {
            get => title; 
            set { 
                title = value;
                NotifyPropertyChanged("Title");
            }  
        }

        public string ClassName {
            get => className; 
            set { 
                className = value;
                NotifyPropertyChanged("ClassName");
            }  
        }
        public bool IsPattern {
            get => isPattern; 
            set { 
                isPattern = value;
                NotifyPropertyChanged("IsPattern");
            }  
        }

        public WinElement WindowEle {
            get => windowEle; 
            set { 
                windowEle = value;
                NotifyPropertyChanged("WindowEle");
            }  
        }

        public string GetTranslateGetWindowMethod() {
            switch(this.getWindowMethod) {
                case 0:
                    return "标题或类名";
                case 1:
                    return "捕获窗口元素";
                case 2:
                    return "当前激活窗口";
                case 3:
                    return "桌面";
                default : return "标题或类名";
            }
        }

        public override void SetLatestVarName(ConcurrentDictionary<string, ConcurrentDictionary<string, RPAVariableDefineWrapper>> globleData) {
            this.windowObj = this.GetLatestName(this.windowObj, globleData);
        }
    }
}
